package com.bawei.module_home

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.alibaba.android.arouter.facade.annotation.Route
import com.bawei.lib_common.Router
import com.bawei.module_home.ui.HomeFragment
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
@Route(path = Router.Ui.HomeActivity)
class HomeActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_home)

        // 防止屏幕旋转等配置变更时重复添加Fragment
        if (savedInstanceState == null) {
            val noticeFragment = HomeFragment() // 创建目标Fragment实例

            // 开启Fragment事务
            supportFragmentManager.beginTransaction()
                .replace(R.id.main, HomeFragment()) // 替换容器内容
                .commit() // 提交事务
        }
    }
}